package com.zhuss.controller.core;

import java.util.List;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.bean.unit.GetuiItem;
import com.zhuss.common.AbstractBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.SelectVo;
import com.zhuss.controller.GetuiUtils;
import com.zhuss.core.annotation.Anon;
import com.zhuss.enums.CompanyType;
import com.zhuss.enums.EnumUtil;
import com.zhuss.enums.ImportType;
import com.zhuss.enums.InfoVisible;
import com.zhuss.enums.IsEnum;
import com.zhuss.enums.MessageType;
import com.zhuss.enums.OperationStatus;
import com.zhuss.enums.OrderStatus;
import com.zhuss.enums.ProductType;
import com.zhuss.enums.RequestMethod;
import com.zhuss.enums.ResourceType;
import com.zhuss.enums.RideType;
import com.zhuss.enums.RoleType;
import com.zhuss.enums.Sex;
import com.zhuss.enums.SiteType;
import com.zhuss.enums.StartStopEnum;
import com.zhuss.enums.StrategyType;
import com.zhuss.enums.SystemEnum;
import com.zhuss.enums.TakeType;
import com.zhuss.enums.TravelPurpose;
import com.zhuss.enums.公司类型;
import com.zhuss.enums.车辆类型;
import com.zhuss.exception.DzcxException;
import com.zhuss.util.DateUtil;


/**
 * 下拉框 controller
 * @Author zhushanshuo
   @Date 2019-11-27 19:58
 *
 */

@Anon
@RestController
@RequestMapping("/select")
public class SelectController extends BaseController {

	@ResponseBody
	@RequestMapping("/testPush")
	public void testPush() throws DzcxException {
		
		new Thread(new Runnable() {
			
			@Override
			public void run() {
				try {
					GetuiUtils.pushMessageToSingle(GetuiItem.test, "f7bb466c1fec868588f27b84d8b6bf96f816f21c24ae2a86570923b5712aa49d", GetuiItem.test, null);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}).start();
		
		new Thread(new Runnable() {
			
			@Override
			public void run() {
				try {
					GetuiUtils.pushTransMessageToSingle(GetuiItem.test, "f7bb466c1fec868588f27b84d8b6bf96f816f21c24ae2a86570923b5712aa49d", GetuiItem.test, 1);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}).start();
	}


	/**
	 * 获取物业管理部门类别
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@RequestMapping("/thirdDeptType")
	public Object thirdDeptType() throws DzcxException {
		return EnumUtil.listSelect(公司类型.class);
	}

	/**
	 * 信息发布可见性下拉框
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@RequestMapping("/infoVisibleList")
	public Object infoVisibleList() throws DzcxException {
		return EnumUtil.listSelect(InfoVisible.class);
	}

	/**
	 * 是否下拉框
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
    @RequestMapping("/isList")
    public Object isList() throws DzcxException {
		return EnumUtil.listSelect(IsEnum.class);
    }

	/**
	 * 系统
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
    @RequestMapping("/systemList")
    public Object systemList() throws DzcxException {
		return EnumUtil.listSelect(SystemEnum.class);
    }

	/**
	 * 资源类型
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
    @RequestMapping("/resourceTypeList")
    public Object resourceTypeList() throws DzcxException {
		return EnumUtil.listSelect(ResourceType.class);
    }

	/**
	 * 请求方法
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@RequestMapping("/requestMethodList")
	public Object requestMethodList() throws DzcxException {
		return EnumUtil.listSelect(RequestMethod.class);
	}

	/**
	 * 角色类型
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@RequestMapping("/roleTypeList")
	public Object roleTypeList() throws DzcxException {
		return EnumUtil.listSelect(RoleType.class);
	}

	/**
	 * 启用停用
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@RequestMapping("/startStopList")
	public Object startStopList() throws DzcxException {
		return EnumUtil.listSelect(StartStopEnum.class);
	}

	/**
	 * 性别
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@RequestMapping("/sexList")
	public Object sexList() throws DzcxException {
		return EnumUtil.listSelect(Sex.class);
	}

	/**
	 * 公司类型
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@RequestMapping("/companyTypeList")
	public Object companyTypeList() throws DzcxException {
		return EnumUtil.listSelect(CompanyType.class);
	}

	/**
	 * 导入类型下拉框
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@PostMapping("/importTypeList")
	public Object importTypeList(@RequestBody AbstractBo bo) throws DzcxException {
		return EnumUtil.listSelect(ImportType.class);
	}

	/**
	 * 未来周下拉框
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@PostMapping("/futureWeekList")
	public Object futureWeekList(@RequestBody AbstractBo bo) throws DzcxException {
		List<SelectVo> weekList = DateUtil.toWeekList(4l);
		return weekList;
	}

	/**
	 * 订单状态下拉框
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@PostMapping("/orderStatusList")
	public Object orderStatusList(@RequestBody AbstractBo bo) throws DzcxException {
		return EnumUtil.listSelect(OrderStatus.class);
	}

	/**
	 * 订单类型下拉框
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@PostMapping("/orderTypeList")
	public Object orderTypeList(@RequestBody AbstractBo bo) throws DzcxException {
		return EnumUtil.listSelect(ProductType.class);
	}

//	/**
//	 * 菜单图标
//	 * @return
//	 * @throws DzcxException
//	 */
//	@ResponseBody
//	@RequestMapping("/iconList")
//	public Object iconList(DetailIconBo bo) throws DzcxException {
//		String[] iconStrList  = Icon.getMap().get(bo.getSystem()).split(",");
//		List<String> iconList = new ArrayList<>();
//		for (String icon : iconStrList) {
//			iconList.add(icon);
//		}
//		return iconStrList;
//	}

	/**
	 * 乘车类型
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@RequestMapping("/rideTypeList")
	public Object rideTypeList() throws DzcxException {
		return EnumUtil.listSelect(RideType.class);
	}

	/**
	 * 出行目的
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@RequestMapping("/travelPurpose")
	public Object travelPurposeList() throws DzcxException {
		return EnumUtil.listSelect(TravelPurpose.class);
	}

	/**
	 * 短信类型
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
    @RequestMapping("/messageTypeList")
    public Object messageTypeList() throws DzcxException {
		return EnumUtil.listSelect(MessageType.class);
    }

	/**
	 * 站点类型
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@RequestMapping("/siteTypeList")
	public Object siteTypeList() throws DzcxException {
		return EnumUtil.listSelect(SiteType.class);
	}

	/**
	 * 车辆类型
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@RequestMapping("/carTypeList")
	public Object carTypeList() throws DzcxException {
		return EnumUtil.listSelect(车辆类型.class);
	}

	/**
	 * 上下车类型
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@RequestMapping("/takeTypeList")
	public Object takeTypeList() throws DzcxException {
		return EnumUtil.listSelect(TakeType.class);
	}

	/**
	 * 策略类型
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@RequestMapping("/strategyTypeList")
	public Object strategyTypeList() throws DzcxException {
		return EnumUtil.listSelect(StrategyType.class);
	}

	/**
	 * 运营状态
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@RequestMapping("/operationStatusList")
	public Object operationStatusList() throws DzcxException {
		return EnumUtil.listSelect(OperationStatus.class);
	}








}
